package com.example.controller;

import com.example.common.Result;
import com.example.entity.Log;
import com.example.entity.Params;
import com.example.service.LogService;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@ResponseBody
@RestController
@CrossOrigin
@RequestMapping("/Log")
public class LogController {

    @Resource
    private LogService logService;


    @GetMapping("/findBySearchOfLog")
    public Result findBySearchOfLog(Params params){
        PageInfo<Log> search = logService.findBySearchOfLog(params);
        return Result.success(search);
    }

    @PostMapping("/addLog")
    public Result addLog(@RequestBody Log log){
       logService.addLog(log);
        return Result.success();
    }

    @DeleteMapping("/deleteLog/{logId}")
    public Result deleteLog(@PathVariable Long logId){
        logService.deleteLog(logId);
        return Result.success();
    }
}
